package iscte.ai.kcgtd;

import java.io.Serializable;

public class Task implements Serializable, Comparable<Task> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -797261819247039525L;
	private String name;
	private String descricao;
	private String categoria;
	private String location;
	private KCGTDTime timeStart;
	private KCGTDTime timeEnd;
	private boolean scheduled;
	private long googleCalendarID;
	private KCGTDTime duration;
	private PeriodStats periodStatsUsed;
	
	public Task(String name, String descricao, String categoria, String location, KCGTDTime duration) {
		this.name = name;
		this.descricao = descricao;
		this.categoria = categoria;
		this.location = location;
		this.duration = duration;
		scheduled = false;
	}

	public KCGTDTime getTimeStart() {
		return timeStart;
	}

	public void setTimeStart(KCGTDTime timeStart) {
		this.timeStart = timeStart;
	}

	public KCGTDTime getTimeEnd() {
		return timeEnd;
	}

	public void setTimeEnd(KCGTDTime timeEnd) {
		this.timeEnd = timeEnd;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public String getCategoria() {
		return categoria;
	}

	public void setCategoria(String categoria) {
		this.categoria = categoria;
	}
	
	public String getLocation() {
		return location;
	}
	
	public void setLocation(String location) {
		this.location = location;
	}

	public boolean isScheduled() {
		return scheduled;
	}
	
	public void setScheduled(boolean scheduled) {
		this.scheduled = scheduled;
	}

	public void setGoogleCalendarID(Long eventID) {
		googleCalendarID = eventID;		
	}
	
	public long getGoogleCalendarID() {
		return googleCalendarID;
	}
	
	public KCGTDTime getDuration() {
		return duration;
	}
	
	public PeriodStats getPeriodStatsUsed() {
		return periodStatsUsed;
	}
	
	public void setPeriodStatsUsed(PeriodStats periodStatsUsed) {
		this.periodStatsUsed = periodStatsUsed;
	}

	@Override
	public int compareTo(Task another) {
		if(this.timeStart.isAfter(another.getTimeStart()))
			return 1;
		else if(this.timeStart.isBefore(another.getTimeStart()))
			return -1;
		else
			return 0;
	}
	
}
